package com.project.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("user")
public class UserController {

    @RequestMapping("add")
    public void add(HttpServletResponse resp) throws IOException {
        resp.getWriter().print("ddd");
    }

    @RequestMapping(value="reg",method = RequestMethod.GET)
    public String register(){

        return "注册";
    }

    @RequestMapping("del/{id}/{name}/{grade}")
    public String del(@PathVariable("id") Integer id,
                      @PathVariable("name") String userName,
                      @PathVariable("grade") Integer grade){

        return "删除成功:"+id+"  "+userName+"   "+grade;
    }

    @RequestMapping("find")
    public String find(@RequestParam(value = "id",defaultValue = "1") Integer id){

        return "id="+id;
    }
}
